<template>
  <div class="app-container">
    <h1>业主管理</h1>
    <el-form :inline="true" :model="form" class="demo-form-inline">
      <el-form-item label="业主姓名">
        <el-input v-model="form.ownerName" placeholder="业主姓名"></el-input>
      </el-form-item>
      <el-form-item label="小区名称">
        <el-input v-model="form.premiseName" placeholder="校区名称"></el-input>
      </el-form-item>
      <el-form-item label="合同录入日期">
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" v-model="form.t3" style="width: 100%;"></el-date-picker>
        </el-col>
        <el-col class="line" :span="2">至</el-col>
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" v-model="form.t4" style="width: 100%;"></el-date-picker>
        </el-col>
      </el-form-item>
      <el-form-item label="房源类型">
        <el-select v-model="form.houseType" placeholder="请选择房源类型">
          <el-option label="国有房产" value="1"></el-option>
          <el-option label="直管房产" value="2"></el-option>
          <el-option label="自管房产" value="3"></el-option>
          <el-option label="军队房产" value="4"></el-option>
          <el-option label="集体所有房产" value="5"></el-option>
          <el-option label="私有(自由)房产" value="6"></el-option>
          <el-option label="港、澳、台投资房产" value="7"></el-option>
          <el-option label="涉外房产" value="8"></el-option>
          <el-option label="其它房产" value="9"></el-option>
        </el-select>
      </el-form-item>


      <el-form-item>
        <el-button type="success" @click="onSubmit">查询</el-button>
        <el-button type="warning" plain @click="empty">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="ownerName"
        label="业主">
      </el-table-column>
      <el-table-column
        prop="sfContractNo"
        label="合同编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="ownerMobile"
        label="电话">
      </el-table-column>
      <el-table-column
        prop="houseName"
        label="小区"
        width="180">
      </el-table-column>
      <el-table-column
        prop="leaseStartTime"
        label="起租日期">
      </el-table-column>
      <el-table-column
        prop="leaseEndTime"
        label="结束日期">
      </el-table-column>
      <el-table-column
        label="押付方式">
        <template slot-scope="scope">
          <span>押{{scope.row.depositType}}付{{scope.row.paymentType}}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="depositMoney"
        label="押金">
      </el-table-column>
      <el-table-column
        prop="monthRent"
        label="租金">
      </el-table-column>
      <el-table-column
        prop="status"
        label="已提交">
        <template slot-scope="scope">
          <span v-if="scope.row.status==2" style="color: red">已提交</span>
          <span v-if="scope.row.status==4" style="color: red">未提交</span>
          <span v-if="scope.row.status==3" style="color: red">已解决</span>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="form.pageNum"
      :page-sizes="[10,20]"
      :page-size="form.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "ownerManagement",
  created() {
    this.init()
  },
  data() {
    return {
      tableData: [],
      total:null,
      form:{
        pageNum:1,
        pageSize:10,
        ownerName:'',
        premiseName:'',
        leaseStartTime:'',
        t3:null,
        t4:null,
        houseType:null
      }
    }
  },
  methods: {
    init(){
      console.log(this.form.ownerName)
      axios.get('http://localhost:8200/hou/TSfContractController/yezhulist',{params:this.form}).then((response)=>{
        this.tableData=response.data.obj.list
        this.form.pageNum=response.data.obj.pageNum
        this.form.pageSize=response.data.obj.pageSize
        this.total=response.data.obj.total
      })
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.form.pageSize=val
      this.init()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.form.pageNum=val
      this.init()
    },
    onSubmit() {
      this.init()
    },
    empty(){
      this.form.ownerName=''
      this.form.premiseName=''
      this.form.t3=null
      this.form.t4=null
      this.form.houseType=null
    }
  }
}
</script>

<style scoped>

</style>
